import axios from 'axios';
import {userAction} from '../../actions';
import qs from 'qs';

export function selUserAll(data,rollback){
    
    return axios({
        method:'post',
        url:'http://localhost:8080/user/selUserAll',
        data:data
        // data:{
        //     param:{aa:"cc"}
        // },
        //   headers: {
        //         'Content-Type': 'application/x-www-form-urlencoded',
        //   }
    }).then(function(res){
        //res = immutable.fromJS(res || {});
        if(res.status==200){
            console.log("接收成功");
            console.log(res.data);
            rollback(res.data);
        }
    });
}

export function selUserById(data,rollback){
    console.log(qs.stringify(data));
    let param = qs.stringify(data);
    return axios({
        method:'post',
        url:'http://localhost:8080/user/selUserById',
        data:param,
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded',
        }
    }).then(function(res){
        //res = immutable.fromJS(res || {});
        if(res.status==200){
            console.log("查询Id成功");
            console.log(res.data);
            rollback(res.data);
        }
    });
}